package org.jeecg.modules.wangyue.interceptor;

import org.jeecg.modules.wangyue.interceptor.filter.TokenFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration   //拦截器注入
//public class WebMvcConfig extends WebMvcConfigurationSupport {
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private TokenFilter tokenFilter; //token拦截器类

    @Override
//    protected void addInterceptors(InterceptorRegistry registry) {
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenFilter)
                .addPathPatterns("/wangyue/app/**")             //拦截的请求
                .excludePathPatterns("/wangyue/applogin/**");   //排除的请求
    }
}
